From: Tim Deegan Date: Tue, 2 Jan 2007 10:57:50 +0000 (+0000) Subject: [HVM] Don't set the shadow allocation to zero if the dom is still shadowed. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15422^2~111 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=66e92e7a4885fca3122068e659340daf2b663f6c;p=xen.git [HVM] Don't set the shadow allocation to zero if the dom is still shadowed. Signed-off-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 8d9676b159..fc68fd9242 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3306,6 +3306,15 @@ int shadow_domctl(struct domain *d, case XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION: shadow_lock(d); + if ( sc->mb == 0 && shadow_mode_enabled(d) ) + { + /* Can't set the allocation to zero unless the domain stops using + * shadow pagetables first */ + SHADOW_ERROR("Can't set shadow allocation to zero, domain %u" + " is still using shadows.\n", d->domain_id); + shadow_unlock(d); + return -EINVAL; + } rc = sh_set_allocation(d, sc->mb << (20 - PAGE_SHIFT), &preempted); shadow_unlock(d); if ( preempted )